package com.snow.vpnclient.vo;

import androidx.databinding.ObservableField;

import com.snow.vpnclient.dto.UserInfoDto;
import com.snow.vpnclient.util.PhoneUtils;

/**
 * @author liufq
 * @since 2022-11-29 17:04:26
 */
public class UserInfoVo {

    private final ObservableField<String> full_name;

    private final ObservableField<String> department;

    private final ObservableField<String> mobile;

    private final ObservableField<String> email;

    private final ObservableField<String> idSource;

    public UserInfoVo() {
        this.full_name = new ObservableField<>();
        this.department = new ObservableField<>();
        this.mobile = new ObservableField<>();
        this.email = new ObservableField<>();
        this.idSource = new ObservableField<>();
    }

    public void setUserInfo(UserInfoDto userInfoDto) {
        if (userInfoDto == null) {
            return;
        }
        this.full_name.set(userInfoDto.getFull_name());
        this.department.set(userInfoDto.getDepartment());
        this.mobile.set(PhoneUtils.blurPhone(userInfoDto.getMobile()));
        this.email.set(userInfoDto.getEmail());
    }

    public void setIdSource(String idSource) {
        this.idSource.set(idSource);
    }
}
